#include <iostream>
#include <thread>
#include <unistd.h>
#include <atomic>

using namespace std;

// 多线程同步
// static int glb;
atomic<int> glb(0);

void thr_job(int n)
{
	for (int i = 0; i < n; i++) {
		// sleep(1);
		glb++;
	}
}

int main(void)
{
	thread thr1(thr_job, 10);
	thread thr2(thr_job, 10);

	thr1.join();
	thr2.join();

	cout << glb << endl;

	return 0;
}

